<template>
  <swiper ref="mySwiper" :options="swiperOptions" v-if="imgList.length>0">
    <swiper-slide v-for="(item,index) in imgList" :key="item.categoryId">
      <img v-lazy="item.imgUrl" alt="">
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
</template>
<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
export default {
  name: 'Slide',
  data() {
    return {
      swiperOptions: {
        pagination: {
          el: '.swiper-pagination'
        },
        loop: true,
        autoplay: true,
      },

    }
  },
  props: {
    imgList: {
      type: Array,
      require: true,
      default: function () {
        return []
      }
    },

  },

  components: {
    Swiper,
    SwiperSlide,
  },

}
</script>
<style scoped>
img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
</style>
